//
//  WSTaskRequest.m
//  CharonTVProject
//
//  Created by karong on 2023/7/31.
//

#import "WSTaskRequest.h"
#import "WSTask.h"
#import "WSSign.h"
#import "WSADManager.h"

@implementation WSTaskRequest

+ (void)loadcharonTV_TaskListWithSuccess:(charonTV_AnyObjectBlock)success failed:(Failure)failed {
    NSString * charonTV_url = API_CHARONTV_TASK_LIST;
    NSDictionary * charonTV_parameters = @{};
    [self postWithURLString:charonTV_url parameters:charonTV_parameters success:^(NSDictionary * _Nonnull responseDict) {
        WSTaskData * taskData = [WSTaskData mj_objectWithKeyValues:responseDict];
        success(taskData);
    } failure:failed];
    
}

+ (void)loadcharonTV_SignListWithSuccess:(charonTV_AnyObjectBlock)success failed:(Failure)failed {
    NSString * charonTV_url = API_CHARONTV_USER_SIGN_LIST;
    NSDictionary * charonTV_parameters = @{};
    [self postWithURLString:charonTV_url parameters:charonTV_parameters success:^(NSDictionary * _Nonnull responseDict) {
        WSSignData * sign = [WSSignData mj_objectWithKeyValues:responseDict];
        success(sign);
    } failure:failed];
}

+ (void)signcharonTV_WithSuccess:(charonTV_EmptyBlock)success failed:(Failure)failed {
    NSString * charonTV_url = API_CHARONTV_USER_SIGN;
    NSDictionary * charonTV_parameters = @{};
    [self postWithURLString:charonTV_url parameters:charonTV_parameters success:^(NSDictionary * _Nonnull responseDict) {
        [appUserCenter getUserInfocharonTV_Request];
        success();
    } failure:failed];
}

+ (void)signcharonTV_DoubleWithSuccess:(charonTV_EmptyBlock)success failed:(Failure)failed {
    NSString * charonTV_url = API_CHARONTV_USER_SIGN_DOUBLE;
    NSDictionary * charonTV_parameters = @{};
    [self postWithURLString:charonTV_url parameters:charonTV_parameters success:^(NSDictionary * _Nonnull responseDict) {
        [appUserCenter getUserInfocharonTV_Request];
        [[WSADManager shared]resetOnlineTimePlayVideoTodayState:YES];
        success();
    } failure:failed];
}
+ (void)receivecharonTV_WithTask_id:(NSInteger)task_id success:(charonTV_EmptyBlock)success failed:(Failure)failed {
    NSString * charonTV_url = API_CHARONTV_TASK_GETREWARD;
    NSDictionary * charonTV_parameters = @{@"task_id":@(task_id)};
    [self postWithURLString:charonTV_url parameters:charonTV_parameters success:^(NSDictionary * _Nonnull responseDict) {
        [appUserCenter getUserInfocharonTV_Request];
        success();
    } failure:failed];
}

@end
